<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>登录</h1>
    用户名: <input type="text" class="inp">
    密码 : <input type="text" class="pwd">
    <button class="btn">登录</button>
    <script>
        let inp = document.querySelector('.inp')
        let pwd = document.querySelector('.pwd')
        let btn = document.querySelector('.btn')
        btn.onclick = function () {
            let xhr = new XMLHttpRequest()
            xhr.open('get', `/log?inp=${inp.value}&pwd=${pwd.value}`, true)
            xhr.send()
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4 && xhr.status === 200) {
                    console.log(xhr.responseText)
                }
            }
        }

    </script>
</body>

</html>